package com.kl.drs.core;
import java.util.List;
import java.util.Map;

/**
 *  create by yatming
 */
public abstract  class BaseModel<T> implements IBaseModel<T> {
	
	public abstract IBaseMapper<T> getBaseMapper();
	
//	public abstract T updateBySelective(T record);
//	
//	public abstract T insertSelective(T record);
//	
//	public abstract T selectByPrimaryKey(Integer id);
//	
//	public abstract T softDeleteByPrimaryKey(Integer id);
//	
//	public abstract T deleteByPrimaryKey(Integer id);
	
	@Override
	public List<T> selectAll() {
		return this.getBaseMapper().selectAll();
	}
	//查询多条记录
	@Override
	public List<T> selectByParameter(T record) {
		return this.getBaseMapper().selectByParameter(record);
	}
	
	public T selectByPrimaryKey(Integer id,boolean b){
		T record = this.getBaseMapper().selectByPrimaryKey(id);
		return record;
	}
	
	public int insertOneRecording(T record,boolean b){
		int n=this.getBaseMapper().insertSelective(record);
		return n;
	}
	
	public List<T> findList(Map<String,Object> condMap,boolean b){
		return this.getBaseMapper().findList(condMap);
	}

	public T findOne(Map<String,Object> condMap,boolean b){
		return this.getBaseMapper().findOne(condMap);
	}
	//更新一条记录
	public int updateOneRecording(T record,boolean b){
		int n=this.getBaseMapper().updateByPrimaryKeySelective(record);
		return n;
	}

}
